﻿/*
/*NHibernate映射代码模板
/*吕震修改使用升级版My Generation映射 Oracle
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using Model.Common;

namespace Model
{
	/// <summary>
	///	PostReply:帖子回复
	/// </summary>
	[Serializable]
	public partial class PostReply : IDataEntity 
	{
		#region 私有成员
			
		private bool keyIsChanged;
		private bool keyIsDeleted;
		private int keyPostReplyId; 
		private int keyBBSUserID; 
		private int keyPostId; 
		private string keyPostReplyCotent; 
		private bool keyIsVistable; 
		private bool keyIsAvavble; 
		private DateTime keyPostReplyTime; 
		private int keyVersion; 		
		
		#endregion
		
		#region 默认( 空 ) 构造函数
		/// <summary>
		/// 默认构造函数
		/// </summary>
		public PostReply()
		{
			keyPostReplyId = 0; 
			keyBBSUserID = 0; 
			keyPostId = 0; 
			keyPostReplyCotent = null; 
			keyIsVistable = false; 
			keyIsAvavble = false; 
			keyPostReplyTime = DateTime.MinValue; 
			keyVersion = 0; 
		}
		#endregion
		
		#region  公有属性
			
		
		/// <summary>
		/// PostReplyId:帖子回复Id
		/// </summary>		
		public virtual int PostReplyId
		{
			get { return keyPostReplyId; }
			set { IsChanged |= (keyPostReplyId != value); keyPostReplyId = value; }
		}
			
		
		/// <summary>
		/// BBSUserID:用户id
		/// </summary>		
		public virtual int BBSUserID
		{
			get { return keyBBSUserID; }
			set { IsChanged |= (keyBBSUserID != value); keyBBSUserID = value; }
		}
			
		
		/// <summary>
        /// PostId:帖子Id
		/// </summary>		
        public virtual int PostId
		{
            get { return keyPostId; }
            set { IsChanged |= (keyPostId != value); keyPostId = value; }
		}
			
		
		/// <summary>
		/// PostReplyCotent:帖子回复内容
		/// </summary>		
		public virtual string PostReplyCotent
		{
			get { return keyPostReplyCotent; }
			set	
			{
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("PostReplyCotent:帖子回复内容无效!", value, value.ToString());
				
				IsChanged |= (keyPostReplyCotent != value); keyPostReplyCotent = value;
			}
		}
			
		
		/// <summary>
		/// IsVistable:帖子是否可见
		/// </summary>		
		public virtual bool IsVistable
		{
			get { return keyIsVistable; }
			set { IsChanged |= (keyIsVistable != value); keyIsVistable = value; }
		}
			
		
		/// <summary>
		/// IsAvavble:帖子是否有效
		/// </summary>		
		public virtual bool IsAvavble
		{
			get { return keyIsAvavble; }
			set { IsChanged |= (keyIsAvavble != value); keyIsAvavble = value; }
		}
			
		
		/// <summary>
		/// PostReplyTime:帖子回复时间
		/// </summary>		
		public virtual DateTime PostReplyTime
		{
			get { return keyPostReplyTime; }
			set { IsChanged |= (keyPostReplyTime != value); keyPostReplyTime = value; }
		}
			
		
		/// <summary>
		/// Version:版本号
		/// </summary>		
		public virtual int Version
		{
			get { return keyVersion; }
			set { IsChanged |= (keyVersion != value); keyVersion = value; }
		}
			
			
		/// <summary>
		/// 对象是否为新增
		/// </summary>
		public virtual bool IsAdded
		{
			get { return keyPostReplyId == 0 ? true : false; }
		}
			
		/// <summary>
		/// 对象的值是否被改变
		/// </summary>
		public virtual bool IsChanged
		{
	 		get { return keyIsChanged; }
            set { keyIsChanged = value; }
		}
		
		/// <summary>
		/// 对象是否已经被删除
		/// </summary>
		public virtual bool IsDeleted
		{
			get { return keyIsDeleted; }
		}
		
		#endregion 
		
		#region 公有函数
		
		/// <summary>
		/// 标记对象已删除
		/// </summary>
		public virtual void MarkAsDeleted()
		{
			keyIsDeleted = true;
			keyIsChanged = true;
		}
		
		/// <summary>
		/// 初始化对象标记
		/// </summary>
		public virtual void ResetMark()
		{
			keyIsDeleted = false;
			keyIsChanged = false;
		}
		
		#endregion
		
		#region 重写Equals和HashCode
		/// <summary>
		/// 用唯一值实现Equals
		/// </summary>
		public override bool Equals( object obj )
		{
			if( this == obj ) return true;
			if( ( obj == null ) || ( obj.GetType() != GetType() ) ) return false;
			PostReply castObj = (PostReply)obj; 
			return ( castObj != null ) &&
				(keyPostReplyId == castObj.PostReplyId );
		}
		
		/// <summary>
		/// 用唯一值实现GetHashCode
		/// </summary>
		public override int GetHashCode()
		{
			int hash = 57; 
			hash = 27 * hash * keyPostReplyId.GetHashCode();
			return hash; 
		}
		#endregion
		
		
	}
}
